﻿@model GoDive.App.DestViewModel

@{
    ViewBag.Title = "潜啊：一个专做潜水的自由社区";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section footer{
    <script src="@Url.Content("/webresource/js/destarticle.js")"></script>
}
@{
    object destID = ViewContext.RouteData.Values["id"];
}
@Html.Partial("~/Views/Dest/detailShared.cshtml")
<div class="plcMenuBarHolder" id="tabs">
    <div class="plcMenuBars">
        <div class="plcMenuBar countryBar">
            <ul class="plcMenuBarList fontYaHei">
                <li class="jieshao"><a href="/dest/detail/@destID"><i class="icon"></i>潜点介绍</a></li>
                <li class="daoda"><a href="/dest/traffic/@destID"><i class="icon"></i>到达方式</a></li>
                <li class="gonglve current"><a href="/dest/article/@destID"><i class="icon"></i>潜水攻略</a></li>
                <li class="dianping"><a href="/dest/comment/@destID"><i class="icon"></i>点评</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="qd-wrap" id="dianping">
    <div class="qd gl">
        <div class="title">
            <h2>潜水攻略</h2>
        </div>
        <ul class="nav nav-pills" id="article-type">
            <li class="active" data-type="0"><a>热门</a></li>
            <li data-type="1"><a>最新</a></li>
            <li data-type="2"><a>精华</a></li>
        </ul>
        <ul class="articles-group articles">
            @{
                foreach (var item in Model.DestinationArticles.Rows)
                {
                    <li class="articles-item">
                        <div class="auth">
                            <a class="author" href="">
                                <img src="http://120.24.102.165@{@item.User.AvatarMiddle}" class="img-circle" alt="">
                            </a>
                        </div>
                        <div class="texts">
                            <div class="title-wrap">
                                <a href="" class="title-small">@item.Title</a>
                                <span class="title-by">By: @item.User.UserName</span><span class="title-by">发表于: @item.DataChangeTime.ToShortDateString()</span>
                                <span class="num-wrap hidden-xs">
                                    <span class="num"><i class="icon icon-favorite"></i>@item.FavoriteCount</span>
                                </span>
                            </div>
                            <div class="content-wrap">
                                <p class="content">@item.Summary</p>
                            </div>
                            <div class="pics">
                                <img src="http://120.24.102.165@{@item.Pic}" alt="">
                            </div>
                        </div>
                    </li>
                }
            }
        </ul>
        @if (Model.DestinationArticles.PageTotalCount > 1)
        {
            <nav>
                <ul class="pagination pull-right">
                    @if (@Model.DestinationArticles.HasPrevPage)
                    {
                        <li class="active"><a href="#" aria-label="Previous">上一页</a></li>
                    }
                    @{
            for (int i = 1; i <= Model.DestinationArticles.PageTotalCount; i++)
            {
                string className = i == Model.DestinationArticles.PageIndex ? "active" : string.Empty;
                <li class="@className" data-page="@i"><a>@i</a></li>
            }
                    }
                    @if (@Model.DestinationArticles.HasNextPage)
                    {
                        <li><a>下一页</a></li>
                    }
                </ul>
            </nav>
        }

    </div>
</div>

<script type="text/template" id="article-template">
  <%_.each(articles, function(item){%>
    <li class="articles-item">
        <div class="auth">
            <a class="author" href="">
                <img src="http://120.24.102.165<%=item.User.AvatarMiddle%>" class="img-circle" alt="">
            </a>
        </div>
        <div class="texts">
            <div class="title-wrap">
                <a href="" class="title-small"><%=item.Title%></a>
                <span class="title-by">By：<%=item.User.UserName%></span><span class="title-by">发表于: <%=item.DataChangeTime%></span>
                <span class="num-wrap hidden-xs">
                    <span class="num"><i class="icon icon-favorite"></i><%=item.FavoriteCount%></span>
                </span>
            </div>
            <div class="content-wrap">
                <p class="content"><%=item.Summary%></p>
            </div>
            <div class="pics">
                <img src="http://120.24.102.165<%=item.Pic%>" alt="">
            </div>
        </div>
    </li>
  <%})%>
</script>